/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Dotke
 */
@Entity
@Table(name = "ACCOUNT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Account.findAll", query = "SELECT a FROM Account a"),
    @NamedQuery(name = "Account.findByAccountId", query = "SELECT a FROM Account a WHERE a.accountId = :accountId"),
    @NamedQuery(name = "Account.findByAccountType", query = "SELECT a FROM Account a WHERE a.accountType = :accountType"),
    @NamedQuery(name = "Account.findByAccountBalance", query = "SELECT a FROM Account a WHERE a.accountBalance = :accountBalance"),
    @NamedQuery(name = "Account.findByIsdisabled", query = "SELECT a FROM Account a WHERE a.isdisabled = :isdisabled")})
public class Account implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ACCOUNT_ID")
    private Integer accountId;
    @Basic(optional = false)
    @Column(name = "ACCOUNT_TYPE")
    private char accountType;
    @Basic(optional = false)
    @Column(name = "ACCOUNT_BALANCE")
    private int accountBalance;
    @Basic(optional = false)
    @Column(name = "ISDISABLED")
    private String isdisabled;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "statementAccountId")
    private Collection<Financialstatement> financialstatementCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "billerAccountId")
    private Collection<Biller> billerCollection;
    @OneToMany(mappedBy = "transFromAccount")
    private Collection<Accounttransaction> accounttransactionCollection;
    @OneToMany(mappedBy = "transToAccount")
    private Collection<Accounttransaction> accounttransactionCollection1;
    @JoinColumn(name = "ACCOUNT_CUSTOMER_ID", referencedColumnName = "CUST_ID")
    @ManyToOne
    private Customer accountCustomerId;
    @JoinColumn(name = "ACCOUNT_BILLER_ID", referencedColumnName = "BILLER_ID")
    @ManyToOne
    private Biller accountBillerId;

    public Account() {
    }

    public Account(Integer accountId) {
        this.accountId = accountId;
    }

    public Account(Integer accountId, char accountType, int accountBalance, String isdisabled) {
        this.accountId = accountId;
        this.accountType = accountType;
        this.accountBalance = accountBalance;
        this.isdisabled = isdisabled;
    }

    public Integer getAccountId() {
        return accountId;
    }

    public void setAccountId(Integer accountId) {
        this.accountId = accountId;
    }

    public char getAccountType() {
        return accountType;
    }

    public void setAccountType(char accountType) {
        this.accountType = accountType;
    }

    public int getAccountBalance() {
        return accountBalance;
    }

    public void setAccountBalance(int accountBalance) {
        this.accountBalance = accountBalance;
    }

    public String getIsdisabled() {
        return isdisabled;
    }

    public void setIsdisabled(String isdisabled) {
        this.isdisabled = isdisabled;
    }

    @XmlTransient
    public Collection<Financialstatement> getFinancialstatementCollection() {
        return financialstatementCollection;
    }

    public void setFinancialstatementCollection(Collection<Financialstatement> financialstatementCollection) {
        this.financialstatementCollection = financialstatementCollection;
    }

    @XmlTransient
    public Collection<Biller> getBillerCollection() {
        return billerCollection;
    }

    public void setBillerCollection(Collection<Biller> billerCollection) {
        this.billerCollection = billerCollection;
    }

    @XmlTransient
    public Collection<Accounttransaction> getAccounttransactionCollection() {
        return accounttransactionCollection;
    }

    public void setAccounttransactionCollection(Collection<Accounttransaction> accounttransactionCollection) {
        this.accounttransactionCollection = accounttransactionCollection;
    }

    @XmlTransient
    public Collection<Accounttransaction> getAccounttransactionCollection1() {
        return accounttransactionCollection1;
    }

    public void setAccounttransactionCollection1(Collection<Accounttransaction> accounttransactionCollection1) {
        this.accounttransactionCollection1 = accounttransactionCollection1;
    }

    public Customer getAccountCustomerId() {
        return accountCustomerId;
    }

    public void setAccountCustomerId(Customer accountCustomerId) {
        this.accountCustomerId = accountCustomerId;
    }

    public Biller getAccountBillerId() {
        return accountBillerId;
    }

    public void setAccountBillerId(Biller accountBillerId) {
        this.accountBillerId = accountBillerId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (accountId != null ? accountId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Account)) {
            return false;
        }
        Account other = (Account) object;
        if ((this.accountId == null && other.accountId != null) || (this.accountId != null && !this.accountId.equals(other.accountId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistence.entity.Account[ accountId=" + accountId + " ]";
    }
    
}
